import { getStore, setStore } from "@/util/store";
import { authMenu } from "@/api/admin/SysMenu.js";
const menu = {
  state: {
    menu: getStore({ name: "menu" }) || [],
  },
  actions: {
    GetMenu({ state, commit }) {
      return new Promise((resolve) => {
        authMenu().then((res) => {
          const menu = res.data.data.menu;
          const button = res.data.data.button;
          state.menu = menu;
          setStore({ name: "menu", content: state.menu });
          commit("SET_PERMISSION", button);
          resolve(res.data.data);
        });
      });
    },
  },
};
export default menu;
